package com.prj.ufdm.cloud.ms.test.config;

import javax.annotation.Resource;

import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import com.prj.ufdm.cloud.ms.test.constants.MsTestConstants;

@Configuration
public class InitParamConfig implements EnvironmentAware{
	
	@Resource
	private Environment env;
	
	@Override
	public void setEnvironment(Environment environment) {
		try {
			if(env.getProperty("qichacha.appkey")!=null && !env.getProperty("qichacha.appkey").equals(""))
			{
				MsTestConstants.QICHACHA_APP_KEY = env.getProperty("qichacha.appkey");
			}
			if(env.getProperty("qichacha.seckey")!=null && !env.getProperty("qichacha.seckey").equals(""))
			{
				MsTestConstants.QICHACHA_SEC_KEY = env.getProperty("qichacha.seckey");
			}
			if(env.getProperty("qixinbao.appkey")!=null && !env.getProperty("qixinbao.appkey").equals(""))
			{
				MsTestConstants.QIXINBAO_APP_KEY = env.getProperty("qixinbao.appkey");
			}
			if(env.getProperty("qixinbao.seckey")!=null && !env.getProperty("qixinbao.seckey").equals(""))
			{
				MsTestConstants.QIXINBAO_SEC_KEY = env.getProperty("qixinbao.seckey");
			}
		}
		catch(Exception er) {
			
		}
	}
}
